package com.meituan.meituanservice.mapper;

import com.meituan.meituanservice.model.Address;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AddressMapper {
    @Select("select * from shipping_address where user_id = #{userId}")
    List<Address> selectAllByUserId(String userId);
    @Delete("delete from shipping_address where address_id = #{addressId}")
    int deleteById(String addressId);
    @Insert("insert into shipping_address(user_id,contact_name,gender,contact_phone,address) values(#{userId},#{contactName},#{gender},#{contactPhone},#{address})")
    int insert(Address address);
    @Update("update shipping_address set contact_name=#{contactName},contact_phone=#{contactPhone},address=#{address},gender=#{gender} where address_id=#{addressId}")
    int update(Address address);

}
